package com.mjk.conver;


import com.mjk.common.base.constns.BeeStatus;
import com.mjk.common.core.jdbc.service.dbconver.ITableConver;
import com.mjk.common.core.jdbc.service.dbconver.annotation.BeeConver;
import com.mjk.common.core.jdbc.service.dbconver.bean.BaseDbResultBean;
import com.mjk.common.core.jdbc.service.plus.idbservice.BaseDBService;
import com.mjk.common.core.jdbc.service.plus.idbservice.BeeDBService;
import com.mjk.common.core.jdbc.service.plus.wrap.BeeQueryWrapper;
import com.mjk.common.tools.logger.BizLogger;
import com.mjk.common.util.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.Map;

//@BeeConver(converName="国籍转化",corn="*/10 * * * * ?",sourceDataSource="oldhis",targetDataSource="his",status = 1)
public class ChargeTypeConver implements ITableConver{
	@Autowired
	private BeeDBService baseDBService;
	
	@Override
	public String getSourceSql() {
		
		return "select * from dictmanage.DICT_PUB_CODE where dict_type='nat_regn' ";
	}
	
	@Override
	public String getTargetSql(BaseDbResultBean result) {
		BizLogger.info(result);
		NationModel model = new NationModel();
		Map<String,Object> map = (Map<String, Object>) result.getResult();
		BeeQueryWrapper wrapper = new BeeQueryWrapper(model);
		wrapper.eq(NationModel::getNAME,MapUtils.getString(map,"DICT_NAME"));
		model.setIOS3(MapUtils.getString(map,"DICT_CODE"));
		baseDBService.update(wrapper);
		return "";
	}
}
